package com.nwpu.am.mapper;

import com.nwpu.am.pojo.entity.*;
import org.apache.ibatis.annotations.*;

@Mapper

public interface SupplierMapper {
    @Insert("INSERT INTO tb_suppliers (suppliers_id, suppliers_name, suppliers_tel, suppliers_email, suppliers_address, suppliers_card) VALUES (#{suppliersId}, #{suppliersName}, #{suppliersTel}, #{suppliersEmail}, #{suppliersAddress}, #{suppliersCard})")
    Supplier insertSupplier(Supplier supplier);

    @Select("SELECT * FROM tb_suppliers WHERE suppliers_id = #{suppliersId}")
    Supplier selectSupplierById(int suppliersId);

    @Select("SELECT * FROM tb_suppliers WHERE suppliers_name = #{supplierName}")
    Supplier selectSupplierByName(String supplierName);

    int updateSupplier(Supplier supplier);

    @Delete("DELETE FROM tb_suppliers WHERE suppliers_id = #{suppliersId}")
    int deleteSupplierById(int suppliersId);
}
